package community.peers.internetradio.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.method.LinkMovementMethod;
import android.view.MenuItem;
import android.widget.TextView;

import community.peers.internetradio.R;

public class AboutActivity extends AppCompatActivity {

    TextView about_text;
    TextView about_usage;
    TextView about_thanks;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);

        /**
         * Display back button.
         * Set whether home should be displayed as an "up" affordance.
         * Set this to true if selecting "home" returns up by a single
         * level in your UI rather than back to the top level or front
         * page.
         */
        //this.getSupportActionBar().setHomeButtonEnabled(true);
        this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        this.setTitle(getString(R.string.about_title));

        // Get references to layout elements
        about_text = (TextView) findViewById(R.id.about_text);
        about_usage = (TextView) findViewById(R.id.about_usage_text);
        about_thanks = (TextView) findViewById(R.id.about_thanks_text);

        /**
         * Allow clickable links.
         * This is required for <a href="">Name</a> links.
         */
        about_text.setMovementMethod(LinkMovementMethod.getInstance());
        about_usage.setMovementMethod(LinkMovementMethod.getInstance());
        about_thanks.setMovementMethod(LinkMovementMethod.getInstance());
    }

    /**
     * Catch tap on action bar items.
     */
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            // Respond to the action bar's Up/Home button
            case android.R.id.home:
                // Destroy Activity (and return to parent)
                this.finish();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
